package com.gh.ggkt.vod.controller;

import com.gh.Result;
import com.gh.ggkt.vod.service.FileService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author Eric Fang
 * @date 2022/9/5 21:29
 */
@RestController
@RequestMapping("/admin/vod/file")
public class FileUploadController {

    @Autowired
    private FileService fileService;

    @PostMapping("upload")
    @ApiOperation("上传")
    public Result uploadFile(MultipartFile file){
        String url = fileService.upload(file);
        return Result.ok(url).message("文件上传成功");
    }
}
